package com.tjetc.字符流;

import java.io.FileReader;
import java.io.IOException;

public class T02FileReader {
    public static void main(String[] args) throws IOException {
        //开管 :输入管程序从输入管里面读取数据
        FileReader fileReader = new FileReader("myfile.txt");
//        int read = fileReader.read();//一次接一滴
//        System.out.println(read);
//        System.out.println( (char)read);

//        //创建水杯
//        char[] chars=new char[1024];
//        //每次接的水滴数
//        int num;
//        //从输入管循环接水,直到接完
//        while ((num=fileReader.read(chars))!=-1){
//            System.out.println(new String(chars,0,num));
//        }
//        fileReader.close();
        //循环接水
        int read;
        while((read = fileReader.read())!=-1){
            System.out.print((char)read);
        }

    }
}
